package com.itheima.Demo05_Combopool连接池;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.sql.SQLException;

public class demo {
    public static void main(String[] args) throws SQLException {
        //创建连接池
        ComboPooledDataSource source = new ComboPooledDataSource();
        for (int i = 0; i < 10; i++) {
            System.out.println(source.getConnection());//这是使用默认配置
        }
        source.close();
        System.out.println("==================================");
        get();
    }
    public static void get() throws SQLException {
        ComboPooledDataSource itheima = new ComboPooledDataSource("itheima");//使用命名配置 根据指定的id使用对应的配置
        for (int i = 0; i < 10; i++) {
            System.out.println(itheima.getConnection());
        }
        itheima.close();
    }
}
